package com.heima.controller;

import com.heima.service.MinioService;
import com.heima.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.concurrent.CompletableFuture;

@RestController
public class MinioController {

    @Autowired
    private MinioService minioService;

//    @Autowired
//    private OssService ossService;
    @PostMapping("/upload")
    public ResponseEntity<String> uploadFile(@RequestParam("file") MultipartFile file) {
        try {
//            String fileUrl = minioService.uploadFile(file);
//            CompletableFuture<String> future = ossService.uploadFile(file);
            return ResponseEntity.ok("上传成功访问路径为");
        } catch (Exception e) {
            return ResponseEntity.status(500).body("File upload failed: " + e.getMessage());
        }
    }
}
